登录 白背景

leetcode/100-n/1436. 旅行终点站.md

https://leetcode-cn.com/problems/destination-city/

func destCity(paths [][]string) (retPath string) {
    retPath = paths[0][1]
    for {
        flag := false
        for _, path := range paths {
            if retPath == path[0] {
                retPath = path[1]
                flag = true
                break
            }
        }
        if !flag {
            break
        }
    }
    return
}